From 66b5d8857c82567041d5d1657af26729e78b4c48 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 25 Sep 2009 10:47:36 +0100 Subject: [PATCH] PoD: Allocate 4k pages if 2 meg allocation fails In p2m_pod_set_cache_target: * If a 2-meg allocation fails, try a 4k allocation * If both allocations fail, return -ENOMEM so that the domain build will fail. Signed-off-by: George Dunlap --- xen/arch/x86/mm/p2m.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 7fba54e0a2..dfbd3fa781 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -386,10 +386,22 @@ p2m_pod_set_cache_target(struct domain *d, unsigned long pod_target) order = 9; else order = 0; - + retry: page = alloc_domheap_pages(d, order, 0); if ( unlikely(page == NULL) ) + { + if ( order == 9 ) + { + /* If we can't allocate a superpage, try singleton pages */ + order = 0; + goto retry; + } + + printk("%s: Unable to allocate domheap page for pod cache. target %lu cachesize %d\n", + __func__, pod_target, p2md->pod.count); + ret = -ENOMEM; goto out; + } p2m_pod_cache_add(d, page, order); } -- 2.30.2